<?php
include_once(_APP_PATH. 'modules/controlls/controllers/params/params_controlls_http_web.php');
class params_controlls_http_ajax extends params_controlls_http_web
{
    public function newfieldPrAction()
    {
		$fieldName = $this->Request()->get('fieldname');
		$fieldArrName = $this->Request()->get('fieldarrname');
		$fieldParamsPath = $this->Request()->get('fieldparamspath');
		$fieldTemplate = $this->Request()->get('fieldtemplate');
		
		$this->SetTemplateFolder($fieldTemplate)->SetFieldArrName($fieldArrName)
												->SetTemplateFolder($fieldTemplate);

        $obj = SysLoader::GetModResponse();      
        
        $params = new MozgParams($fieldParamsPath);
        
        $configField = false;
        if ($params->IsSetConfig())
        {
        	$configField = $params->GetConfigField($fieldName);	
        }

        if ($configField)
        {
			$obj->SetStatus(MR_STATUS_OK);
			$obj->value = $this->GetFieldHtml($fieldName, $configField, $params->Get($fieldName));
			$obj->field = $fieldName;
        }
        else
        {
            $obj->SetMessage('Параметр не найден');
            $obj->SetStatus(MR_STATUS_ERROR);         	
        }			
		
        $this->Response()->SetBody($obj);  			
    }
}